package com.zaoqi.controller;

import com.zaoqi.pojo.Result;
import com.zaoqi.service.HistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.sql.Date;

@RestController
@RequestMapping(value = "/api/history")
public class HistoryController {

    @Autowired
    private HistoryService historyService;

    @GetMapping
    public Result getHistoryRecords(
            @RequestParam(required = false) String operator,
            @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") java.util.Date operateDate) {
        return Result.success(historyService.getHistoryRecords(operator, operateDate));
    }
}

